<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<!-- Set render engine for 360 browser -->
	<meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

	<link href="/public/simpleboot/themes/<?php echo C('SP_ADMIN_STYLE');?>/theme.min.css?1" rel="stylesheet">
    <link href="/public/simpleboot/css/simplebootadmin.css?8" rel="stylesheet">
    <link href="/public/js/artDialog/skins/default.css" rel="stylesheet" />
	<link href="/public/css/other.css?<?php echo time(); ?>" rel="stylesheet" />
    <link href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome.min.css"  rel="stylesheet" type="text/css">
    <style>
		form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
		.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;}
		.table-list{margin-bottom: 0px;}
	</style>
	<!--[if IE 7]>
	<link rel="stylesheet" href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome-ie7.min.css">
	<![endif]-->
	<script type="text/javascript">
	//全局变量
	var GV = {
	    ROOT: "/",
	    WEB_ROOT: "/",
	    JS_ROOT: "public/js/",
	    APP:'<?php echo (MODULE_NAME); ?>'/*当前应用名*/
	};
	</script>
    <script src="/public/js/jquery.js"></script>
    <script src="/public/js/jquery.quicksearch.js"></script>
    <script src="/public/js/wind.js"></script>
    <script src="/public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
    <script>
    	$(function(){
    		$("[data-toggle='tooltip']").tooltip();
    	});
    </script>
<?php if(APP_DEBUG): ?><style>
		#think_page_trace_open{
			z-index:9999;
		}
	</style><?php endif; ?>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="<?php echo U('AdminPackage/index');?>">流量包管理</a></li>
        <li class="active"><a href="<?php echo U('AdminPackage/add',array('id'=>empty($item['id'])?'':$item['id']));?>" target="_self">新增</a></li>
    </ul>
    <form action="<?php echo U('AdminPackage/add_post');?>" method="post" class="form-horizontal js-ajax-forms" enctype="multipart/form-data" onsubmit="return check_form();">
        <div class="row-fluid">
            <div class="span9">
                <table class="table table-bordered">
                    <tr>
                        <th>套餐类型 <span class="form-required">*</span></th>
                        <td>
                            <label class="checkbox inline">
                            <input value="1" <?php if($item['package_type'] != 2): ?>checked<?php endif; ?>  type="radio" name="package_type" onchange="change_package()" >&nbsp;&nbsp;月套餐&nbsp;&nbsp;
                            </label>
                            <label class="checkbox inline">
                                <input value="2" <?php if($item['package_type'] == 2): ?>checked<?php endif; ?>  type="radio" name="package_type" onchange="change_package()">&nbsp;&nbsp;增量包&nbsp;&nbsp;
                            </label>

                        </td>
                    </tr>

                    <tr>
                        <th>流量(M) <span class="form-required">*</span></th>
                        <td>
                            <input type="text" name="package_data" on class="require number" id="package_data" value="<?php echo ($item["package_data"]); ?>" style="width: 400px" placeholder="请输入流量(M)">
                            <span style="color:red" class="package_data1">最低流量为30M，且为10的整数</span>
                            <span style="display: none;color:red" class="package_data2">最低流量为10M，且为10的整数</span>
                        </td>
                    </tr>

                    <tr>
                        <th>价格 <span class="form-required">*</span></th>
                        <td>
                            <input type="text" name="package_price" class="require" id="package_price" value="<?php echo ($item["package_price"]); ?>" style="width: 400px" placeholder="请输入价格">
                        </td>
                    </tr>

                    <!--<tr>-->
                        <!--<th>流量标题 <span class="form-required">*</span></th>-->
                        <!--<td>-->
                            <!--<input type="text" name="package流量标题data" class="require" id="package流量标题data" value="<?php echo ($item["package流量标题data"]); ?>" style="width: 400px" placeholder="请输入流量标题">-->
                        <!--</td>-->
                    <!--</tr>-->

                    <!--<tr>-->
                        <!--<th>价格标题 <span class="form-required">*</span></th>-->
                        <!--<td>-->
                            <!--<input type="text" name="package价格标题price" class="require" id="package价格标题price" value="<?php echo ($item["package价格标题price"]); ?>" style="width: 400px" placeholder="请输入价格标题">-->
                        <!--</td>-->
                    <!--</tr>-->
                </table>
            </div>
        </div>
        <div class="form-actions">
            <input type="hidden" name="id" value="<?php echo ($item["package_id"]); ?>"/>
            <button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
            <a class="btn" href="<?php echo U('AdminPackage/index');?>">返回</a>
        </div>
    </form>
</div>
<script type="text/javascript" src="/public/js/common.js"></script>
<script>
    function check_form(){
        var package_type = $("input[name='package_type']:checked").val();
        console.log(package_type);
        var package_data = $("#package_data").val();
        var package_price = $("#package_price").val();
        if(package_data == ''){
            alert("流量值不能为空！");return false;
        }
        if(isNaN(package_data)){
            alert("流量值输入有误！");return false;
        }

        if(package_price == ''){
            alert("价格不能为空！");return false;
        }
        if(isNaN(package_price)){
            alert("价格输入有误！");return false;
        }
        return true;
    }
    function change_package(){
        var package_type = $("input[name='package_type']:checked").val();
        if(package_type == 1){
            $(".package_data1").show();
            $(".package_data2").hide();
        }else{
            $(".package_data1").hide();
            $(".package_data2").show();
        }
    }
</script>
</body>
</html>